package me.send.data.service.mapper;

import java.util.List;
import java.util.Map;

import me.send.data.service.pojo.Broker;
import me.send.data.service.provider.BrokerProvider;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

public abstract interface BrokerMapper {

	// 管理员的用户 2015年6月19日10:20:00

	/**
	 * 后台登录系统 登录方法
	 * 
	 * 2015年6月19日10:20:14
	 */
	@Select(value = "select * from broker where username = #{username} and password = #{password}")
	public abstract Map<String, Object> broker_login(
			Map<String, Object> parameter);

	@SelectProvider(method = "list_page", type = BrokerProvider.class)
	public abstract List<Map<String, Object>> page(Map<String, Object> parameter);

	@SelectProvider(method = "count", type = BrokerProvider.class)
	public abstract int count(Map<String, Object> parameter);
	
	@SelectProvider(method = "countUnauthed", type = BrokerProvider.class)
	public abstract int countUnauthed(Map<String, Object> parameter);

	@SelectProvider(method = "batch_delete", type = BrokerProvider.class)
	public abstract void batch_delete(Map<String, Object> parameter);

	@SelectProvider(method = "unAuthenedList", type = BrokerProvider.class)
	public abstract List<Broker> getUnAuthenedBrokers(Map<String, Object> parameter);
	
	@Select(value="SELECT p.popid,p.username,p.status,p.telephone,p.headerpath,p.sex,p.`level`,"
			+ "p.istrained,istested,p.positive_id_path positiveIdPath,p.negative_id_path negativeIdPath,p.hand_id_path handIdPath,"
			+ "p.authen_tel authenTel,p.real_name realName,p.id_num idNum,p.isauthen isAuthen,p.isvAccountId isvAccountId "
			+ "FROM popuser p WHERE p.popid=#{popid}")
	public abstract Broker getBrokerDetail(int popid);
	
	@Update(value="UPDATE popuser SET isauthen=#{status} WHERE popid=#{brokerid} AND isauthen=1")
	public abstract int authen(Map<String, Object> pamras);
}
